﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Windows.Controls;
using PlaneWar.Foundation;

namespace PlaneWar.Helper
{
    public class BackGroundImg_Hleper : VMParentCls, INotifyPropertyChanged
    {

        private UserControl _view;
        public BackGroundImg_Hleper(UserControl view)
        {
            this._view = view;
            this._view.DataContext = this;
            this.ImgTop1 = 0;
            this.ImgTop2 = -500;
        }


        private double imgTop1;
        public double ImgTop1
        {
            get { return imgTop1; }
            set { imgTop1 = value; OnPropertyChanged("ImgTop1"); }
        }


        private double imgTop2;
        public double ImgTop2
        {
            get { return imgTop2; }
            set { imgTop2 = value; OnPropertyChanged("ImgTop2"); }
        }

        public override void Run(double V)
        {
            base.Run(V);

            this.ImgTop1 += V;
            this.ImgTop2 += V;
            if (this.ImgTop1 >= 500)
            {
                this.ImgTop1 = 0;
                this.ImgTop2 = -500;
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
        public void OnPropertyChanged(string arg)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(arg));
            }
        }
    }
}
